import plotly.express as px


def get_pfc_pie_figure(proteins, fats, carbs):
    pfc_weights = {
        "Нутриент": ["Белки", "Жиры", "Углеводы"],
        "Вес нутриента (гр)": [proteins, fats, carbs]
    }
    sum_energy = proteins * 4.1 + fats * 9.3 + carbs * 4.1
    pie = px.pie(
        title=f"Калорийность: {sum_energy:.2f} ккал",
        data_frame=pfc_weights,
        values="Вес нутриента (гр)",
        names="Нутриент",
        hole=0.6,
    )
    return pie
    